#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct account{
	char password[10];
	int balance;
};

int main()
{
	struct account a ={"123456",10000};
	
	char response[10];
	
    printf("这是您首次登录该银行系统，初始密码为123456，请问是否修改？（Yes/No)\n");
	scanf("%s",response);
	
	if(strcmp(response,"Yes")==0){
	    
		printf("请输入新的六位存储密码\n");
		scanf("%s",a.password);
		printf("修改成功\n");
	}
	
	char x[10];
	
	printf("请输入密码以用于验证\n");

		int cot;
	
		for(cot=1;cot<=3;cot++){
		
			scanf("%s",x);
			
			if(strcmp(a.password,x)==0){
	
				printf("密码正确\n");
				
				break;
			}
					else{
						if(cot<3){
		printf("密码错误，您还有%d次输入机会\n",3-cot);
						}
						else{
							printf("次数用尽,您无法登入;\n");
						
							exit(0);
						}
				}
	}
	
	int b=0;
	int n=0;
	
	while(1){
		
	printf("请输入您想进行的操作：\n1.存钱\n2.取钱\n3.余额查询\n4.退出程序\n");
	scanf("%d",&b);
		
	switch(b){
	case 1:
		printf("请输入存入的金额\n");
		scanf("%d",&n);
		
		a.balance += n;
		
		printf("存入成功!您当前余额为：%d元\n",a.balance);
		break;
	case 2:
		printf("请输入取出的金额\n");
		scanf("%d",&n);
		
		a.balance -= n;
		
		printf("取出成功!您当前余额为：%d元\n",a.balance);
		break;
	case 3:
		printf("您当前余额为：%d元\n",a.balance);
		break;
    case 4:
		exit(0);
	}
		
	}
    return 0;
	
}
